JavaScript

A5.chartDefinition Label Object

Description

The definition of a label element.

Discussion

This object contains a common set of properties that multiple "parent" definition use. The noted properties ("location", "rotate", "offset.axis", "callout.from" and "callout.location") will be specific to a "parent" definition. This "parent" definition should be referred to when choosing a value to use for these specific properties.

Properties

locationstringfunction(data,temp)

The location of the label. To not draw labels a value of "none" can be used. Other excepted values are to be found in the "parent" definition. A function called with "data" (see A5.chart Render Data Object) and "temp" can be used to dynamically calculate the location.

rotatenumberstring

The rotation (in degrees) to apply to the label. If the chart is "polar" or "radial" then a string with the value of "auto", "normal" or "tangent" can be specified to dynamically calculate the angle base on the label location on the axis.

htmlstringfunction(data,temp)

The HTML to add to the label element. A string will be considered to be templates (see A5.u.template). A function called with "data" (see A5.chart Render Data Object) and "temp" can be used to dynamically calculate the HTML.

offsetobject

The offset of the label.

axisnumber

In "polar" and "radial" charts, the offset relative to the center of the chart.

majornumber

The major offset relative to the axis. The default value is 0.

minornumber

The minor offset relative to the axis. The default value is 0.

colorstringfunction(data,temp)

The color of the label element. A value of "default" will use the palette default text color. A function called with "data" (see A5.chart Render Data Object) and "temp" can be used to dynamically calculate the class name.

outlinebooleanobject

If true or an object then the text will be outlined to make it more readable over unknown backgrounds.

colorstring

The CSS color to use for the text outline. If not supplied then the palette default will be used.

widthnumber

The number of pixels of solid outline to have around the text. If not supplied then the palette default will be used.

halonumber

The number of pixels of halo falloff to have around the outline of the text. If not supplied then the palette default will be used.

classNamestringfunction(data,temp)

The class name to add to the label element. A function called with "data" (see A5.chart Render Data Object) and "temp" can be used to dynamically calculate the class name.

stylestringfunction(data,temp)

The CSS style to add to the label element. A function called with "data" (see A5.chart Render Data Object) and "temp" can be used to dynamically calculate the style.

calloutobject

The settings to control the drawing of the callout if the label location is "callout".

fromstringfunction(data,temp)

The location from which to start the callout. This property may not apply to all definitions that use labels. The "parent" definition will discus excepted values if applicable.

locationstringobjectfunction(data,temp)

The "location" of label for the callout (see A5.chart Definition Location Object). An extra property of "align" can be set to control where the label is positioned relative to this location. Values of "align" can be any combination of "center", "above", "below", "before" and "after". This property may not apply to all definitions that use labels. The "parent" definition will discus excepted values if applicable.

typestring

The type of line to draw. Values can be "line" (the default), "step", "smooth" and "step-smooth". Stepped lines will travel either horizontally or vertically for a set percentage of the distance from both the start and end points before connecting the two locations. Smoothing will add a curve to the line.

steparray

If they line "type" of callout is "stepped", then an array with the distance at which each step occurs. The value can be between "0" (the start) and "1" (the end). The default is [.25,.75].

amountnumber

If they line "type" of callout has "smoothing", then the "amount" contains the left of curvature to use. The value can be between "0" (none) and "1".

markobject

Controls the small line segments to add off the initial positions of the start and/or end.

startnumber

The length to travel away from the start point before continuing to draw the callout. The default is 4.

endnumber

The length to travel away from the end point before continuing to draw the callout. The default is 4.

lineobject

The callout line definition. See A5.chart Definition Line Object.

distributeobjectfunction(data,temp)

The definition of how to distribute the label for the callout. This only applies if the callout will be one of many (for instance a callout from a "pie" slice). A function called with "data" (see A5.chart Render Data Object) and "temp" can be used to dynamically calculate the location of the label by returning the "location" to be consumed by A5.chart.u.layout.position.

tostringarrayfunction(data,temp)

Base positions are "auto" (choose the nearest), "top", "bottom", "left", "right". A suffix of "-fill" can be added to make the labels spread to fill the area. On all positions except "auto", alignment can be added by a suffix with an alternate position separated by a "-". For instance "left-top". A function called with "data" (see A5.chart Render Data Object) and "temp" can be used to dynamically calculate the position.

sizenumberfunction(data,temp)

The size a callout label should take up when being distributed. A function called with "data" (see A5.chart Render Data Object) and "temp" can be used to dynamically calculate the size.

attrsstringfunction(data,temp)

The attributes to add to the label element. A function called with "data" (see A5.chart Render Data Object) and "temp" can be used to dynamically calculate the attributes.

tipstringfunction(data,temp)

The mouseover tip to add to the label element. A function called with "data" (see A5.chart Render Data Object) and "temp" can be used to dynamically calculate the tip.

pointerEventsstringfunction(data,temp)

If true (the default) then pointer events will be allowed. A function called with "data" (see A5.chart Render Data Object) and "temp" can be used to dynamically calculate the tip.

This object reflects a group of settings common to multiple "parent" definitions. Several properties will have values specific to a "parent" definition. These are "location", "rotate", "offset.axis", "callout.from" and "callout.location"